<?php
$authedUser = $session->read('Auth.User');
echo $form->create('EventAsset', array('url'=>'/'.$this->params['url']['url'],"enctype"=>"multipart/form-data",'id'=>'event_asset_add_form'));
?>


<?php
if(cr('EventConfig.guest_upload_photo') == 1 && empty($authedUser))
{
	$guestFields = cri('Users.Guest')->getFields('group', 'add');
	foreach($guestFields as $field)
	{
		echo $form->input('Guest.'.$field);
	}
}
//fake call initialize EventAssetwModel in form helper.
echo $form->input('EventAsset.fake',array('type'=>'hidden'));

?>
<?php
echo $form->hidden('event_id',array('value'=>$item_id));
echo $form->input('name', array('type'=>'file','label'=>__('Upload Image')));
echo $form->hidden('type',array('value'=>$type));
echo $form->end(__('Submit'));
?>

<script
	type="text/javascript" src="/cms/js/jquery.validate.min.js"></script>
<script type='text/javascript'>
$(document).ready(function()
{
	$('#GuestName').parent('div').addClass('required');
	$('#GuestEmail').parent('div').addClass('required');
	
	$('.submit').live('click',function(e)
	{		
		if($("#event_asset_add_form").valid()==false)
		{
			return;
		}
	});
});
</script>
